import { Type } from "class-transformer";
import { Menu } from "../entities/menu.entity";
import { IsNumber, IsOptional, IsString } from "class-validator";
import { OmitType } from "@nestjs/swagger";

export class ReqUpdateMenu extends Menu {
  /**
   * @description: 父部门id
   * @return {*}
   */
  @Type()
  @IsNumber()
  parentId: number;
}

export class ReqAddMenuDto extends OmitType(Menu, ["menu_id"] as const) {
  /* 父部门Id */
  @Type()
  @IsNumber()
  parentId: number;
}

// 查询条件
export class ReqSearchDto {
  @IsString()
  @IsOptional()
  menu_name: string; // 菜单名称

  @IsString()
  @IsOptional()
  name: string; // 菜单别名

  @IsString()
  @IsOptional()
  path: string; // 路由地址

  @IsString()
  @IsOptional()
  component: string; // 组件路径
}
